package cn.gongwebo.payview.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.gongwebo.payview.R;
import cn.gongwebo.payview.util.ToastUtil;
import cn.gongwebo.payview.widget.dialog.PayDialog;
import cn.gongwebo.payview.widget.dialog.PayFragment;

public class KeyActivity extends AppCompatActivity {

    @BindView(R.id.et_money)
    EditText mEtMoney;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_key);
        ButterKnife.bind(this);
    }

    public void pay(View view) {
        String money = mEtMoney.getText().toString();
        if (TextUtils.isEmpty(money)) {
            ToastUtil.show(KeyActivity.this, "您还未输入金额");
            return;
        }
        PayFragment payFragment = new PayFragment();
        Bundle bundle = new Bundle();
        bundle.putString(PayFragment.MONEY, money);
        payFragment.setArguments(bundle);
        payFragment.show(getFragmentManager(), "pay");

    }

    public void payNative(View view) {
        PayDialog payDialog = new PayDialog();
        payDialog.show(getFragmentManager(), "pay");
    }
}
